
#ifndef _MEMBER_BCAMERA_H_
#define _MEMBER_BCAMERA_H_

#include <BMap>
#include <BPlane>
#include <BImage>
#include <BNode>
#include <BLight>
#include <BScene>
#include <BCamera>
#include <BHandler>
#include <BFrustum>

#include "member_BScene.h"

#define camera_member(camera)		((member_BCamera*)((BCamera*)camera)->_ptr)

namespace BWE
{
	class member_BCamera
	{
	public:
		member_BCamera(BCamera* camera);
		~member_BCamera();

		void adjustLensSize();
		void freshFrustum();

		void prepare();
		void prepare(SceneOctTreeItem& item);
		void prepare(BGroup* group);
		void prepareShapes(BSet<BNodeHolder>& nodes, BSet<BShapeHolder>& shapes);

		void frame(BScene* scene, BHandler* handler = 0);
		void drawShape(ShapeInfo& sinfo, BRender* render);
		void renderHandler(BHandler* handler, BRender& render);

		BCamera*			boss;
		bool				ortho;
		BVector				center;
		BVector				up;
		BVector				direct;
		BVector				right;
		BReal				fovy;
		BReal				near;
		BReal				far;
		BReal				lensWidth;
		BReal				lensHeight;
		BSize				pixelSize;
		Policy				pixelSizePolicy;
		BColor				color;
		bool				culling;
		int					samples;
		int					shadowSize;

		bool				refresh;
		bool				dirtyFrustum;
		bool				resized;
		BUInt				fbo;
		BUInt				rbo;
		BUInt				tbo;
		BUInt				msfbo;
		BUInt				msrbo;
		BUInt				mstbo;
		BScene*				scene;
		BFrustum			frustum;
		SceneOctTreeItemArray	sceneItems;
		ShapeInfoArray		shapeArray;
		ShapeInfoQueue		transShapeQueue;

	};
}

#endif
